Micron Document
πŸŽ–οΈGitΠ―Ρ€Π°πŸŽ–οΈ


Displaying Rendered β€’ View raw β€’ Download

specs/005-tak-v2-protocol/quickstart.md bd2863243bab6eb213401d949839a2bc74dde7e2 (bd286324) Text, 4.65 KB

Quickstart: TAK v2 Protocol Integration

Prerequisites

β€’ JDK 21
β€’ Android Studio (latest stable)
β€’ T383838ANDROID_HOME environment variable set
β€’ Git submodule initialized: T383838git submodule update --init
β€’ T383838local.properties exists: T383838cp secrets.defaults.properties local.properties

Build & Test

T282828
T8b949e# Full verification
./gradlew spotlessApply spotlessCheck detekt assembleDebug :core:takserver:allTests :feature:settings:allTests

T8b949e# TAK module tests only
./gradlew :core:takserver:allTests

T8b949e# Quick compile check (no tests)
./gradlew :core:takserver:compileKotlinJvm


Module Overview

The TAK v2 implementation lives primarily in T383838core/takserver/:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Layer β”‚ Location β”‚ Purpose β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Business Logic β”‚ T383838core/takserver/src/commonMain/ β”‚ All conversion, compression, p… β”‚
β”‚ Platform (JVM) β”‚ T383838core/takserver/src/jvmAndroidMain/ β”‚ TLS server, zstd compression, … β”‚
β”‚ Platform (Android) β”‚ T383838core/takserver/src/androidMain/ β”‚ File writer (SAF) β”‚
β”‚ Platform (iOS) β”‚ T383838core/takserver/src/iosMain/ β”‚ Stubs (uncompressed mode) β”‚
β”‚ UI β”‚ T383838feature/settings/.../TAKConfigItemList.kt β”‚ Config screen β”‚
β”‚ Wake Lock β”‚ T383838core/service/.../MeshService.kt β”‚ CPU keepalive β”‚
β”‚ Version Gate β”‚ T383838core/model/.../Capabilities.kt β”‚ T383838supportsTakV2 flag β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Entry Points

Starting the TAK Server

The TAK server is started via T383838TAKMeshIntegration.start(scope) which is called from T383838MeshService when a device connects. The lifecycle:

1. T383838MeshService.onStartCommand() β†’ acquires wake lock
2. T383838TAKMeshIntegration.start(scope) β†’ wires up three collection jobs:
β€’ Inbound: TAK client β†’ mesh
β€’ Outbound: mesh β†’ TAK clients
β€’ Config: team/role sync
3. T383838TAKServerManager.start(scope) β†’ starts TLS listener on port 8089

Adding a New CoT Type

1. Add enum value to T383838TakV2TypeMapper bidirectional map
2. Add test fixture XML in T383838src/jvmAndroidMain/resources/tak_test_fixtures/
3. Verify round-trip in T383838TAKPacketV2RawDetailTest or T383838CoTConversionTest
4. Run: T383838./gradlew :core:takserver:allTests

Testing with ATAK

1. Enable TAK server in Settings β†’ Module Configuration β†’ TAK
2. Tap "Export Data Package" β†’ share to ATAK
3. In ATAK: Settings β†’ Network β†’ TAK Servers β†’ Import
4. Verify connection count shows 1 in Meshtastic UI

Architecture Flow

T282828
ATAK Client ──TLS──▢ TAKServer (port 8089)
β”‚
β–Ό
TAKServerManager
β”‚
β–Ό inboundMessages
TAKMeshIntegration
β”‚ β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ └──────────┐
β–Ό β–Ό
sendCoTToMeshV2() sendCoTToMeshV1()
(fw β‰₯ 2.8.0) (fw < 2.8.0)
β”‚ β”‚
β–Ό β–Ό
TakV2Compressor TAKPacketConversion
(zstd + dict) (raw protobuf)
β”‚ β”‚
β–Ό β–Ό
Port 78 (ATAK_PLUGIN_V2) Port 72 (ATAK_PLUGIN)
β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β–Ό
Mesh Network (LoRa)

Test Fixtures

38 XML fixture files in T383838src/jvmAndroidMain/resources/tak_test_fixtures/ covering:
β€’ PLI: 6 variants (basic, full, itak, stationary, takaware, webtak)
β€’ GeoChat: 3 variants (broadcast, DM, simple)
β€’ Markers: 6 variants (2525, goto, goto-itak, icon-set, spot, tank)
β€’ Drawings: 7 variants (circle, ellipse, freeform, polygon, rectangle, rectangle-itak, telestration)
β€’ Routes: 2 variants (3wp, itak-3wp)
β€’ Aircraft: 2 variants (ADSB, hostile)
β€’ Ranging: 3 variants (bullseye, circle, line)
β€’ Others: casevac (2), emergency (2), alert (1), delete (1), chat-receipt (2), task (1), waypoint (1)

Dependency Graph

T282828
core:takserver
β”œβ”€β”€ core:repository (mesh packet access)
β”œβ”€β”€ core:common (dispatchers, utilities)
β”œβ”€β”€ core:di (Koin module registration)
β”œβ”€β”€ core:model (Capabilities, domain models)
β”œβ”€β”€ core:proto (protobuf definitions)
β”œβ”€β”€ xmlutil (XML parsing/serialization)
β”œβ”€β”€ TAKPacket-SDK v0.1.3 (zstd compression, JVM only)
β”œβ”€β”€ zstd-jni 1.5.7-7 (native zstd, platform-specific)
β”œβ”€β”€ okio (I/O)
β”œβ”€β”€ ktor-network (TCP)
β”œβ”€β”€ kotlinx-datetime
└── kermit (logging)

Served by rngit 1.5.0 - Generated in 0.04s